import 'package:agora_rtc_engine/agora_rtc_engine.dart';
import 'package:flutter/cupertino.dart';
import 'package:gameplay_flutter/m_chatroom/src/template/music/widget/play_all_widget.dart';
import 'package:get/get.dart';

import '../../../../../lib_baseview/utils/screen_utils.dart';
import '../model/room_music_center_controller.dart';
import '../model/room_music_list_controller.dart';

/// 在线音乐列表子界面
class RoomMusicListPage extends StatelessWidget {
  final MusicChartInfo info;

  final centerController = Get.find<RoomMusicCenterController>();

  RoomMusicListPage(this.info, {super.key}) {
    Get.put(RoomMusicListController(info), tag: '${info.id}');
  }

  @override
  Widget build(BuildContext context) {
    return GetBuilder<RoomMusicListController>(
        tag: '${info.id}',
        builder: (logic) {
          if (logic.data == null) {
            return const Center(child: CupertinoActivityIndicator());
          }

          // if(logic.count <= 0){
          //   return Center(child: DFEmptyDataView());
          // }

          return Column(
            mainAxisSize: MainAxisSize.max,
            children: [
              PlayAllWidget(count: logic.count, onTap: () => logic.playAll()),
              Expanded(child: Text('xxxx')),
              // Expanded(
              //   child: JxRefresher(
              //     controller: logic.controller,
              //     onLoading: logic.loadData,
              //     onRefresh: logic.refreshData,
              //     canLoad:logic.canLoadMore,
              //     canRefresh: true,
              //     content:  ListView.builder(
              //       itemBuilder: (c,index){
              //         return Padding(
              //           padding: const EdgeInsets.only(top: 4,bottom:4),
              //           child: MusicItemWidget(item: logic.data![index]),
              //         );
              //       },
              //       itemCount: logic.count,
              //     ),
              //   ),
              // ),
              SizedBox(
                height: 130 + ScreenUtils.ins.iphoneXBottom,
              )
            ],
          );
        });
  }
}
